<?php
/**
 * Copyright (C), 2021-2021, Shall Buy Life info. Co., Ltd.
 * FileName: CsrfController.php
 * Description: 说明
 *
 * @author lwl
 * @Create Date    2021/11/29 10:00
 * @Update Date    2021/11/29 10:00 By lwl
 * @version v1.0
 */

namespace Example\Controllers\Basic;

use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Redis;

class CsrfController extends Controller
{
    public function csrfToken()
    {
        $csrfToken = uuid();
        Cache::put(config('common.cache.csrf.token').$csrfToken,$csrfToken,config('common.cache.csrf.ttl'));
//        dd(Cache::get(config('common.cache.csrf.token').$csrfToken));
//        Redis::setex(config('common.cache.csrf.token') . $csrfToken, config('common.cache.csrf.ttl'), $csrfToken);
        return ['csrf_token' => $csrfToken];
    }
}
